<template>
	<view class="check">
		<view class="leftBorder">票面基本信息</view>
		<view class="box">
			<view class="flex-between">
				<view>场次类型：</view>
				<view>{{checkdata.fish_new_type==0?"定时鱼票":"循环鱼票"}}</view>
			</view>
			<view class="flex-between">
				<view>钓场：</view>
				<view>{{checkdata.fish_place_name}}</view>
			</view>
			<view class="flex-between">
				<view>场次名称：</view>
				<view>{{checkdata.title}}</view>
			</view>
			<view class="flex-between">
				<view>垂钓鱼种：</view>
				<view>{{checkdata.main_fish_name}}</view>
			</view>
			<view class="flex-between">
				<view>玩法：</view>
				<view>{{checkdata.play_method_name}}</view>
			</view>
			<view class="flex-between">
				<view>撒鱼量：</view>
				<view>{{checkdata.fish_number}} 斤</view>
			</view>
		</view>
		<view class="leftBorder">场次基本信息</view>
		<view class="box">
			<view v-if="checkdata.fish_new_type == 0">
				<view class="flex-between">
					<view>开场日期：</view>
					<view class="flex-end data_list" v-if="Array.isArray(checkdata.data_list)">
						<view class="data_list_item" v-for="item in checkdata.data_list">{{item}}</view>
					</view>
					<view class="flex-end data_list" v-if="typeof checkdata.data_list == 'string'">
						<view class="data_list_item">{{checkdata.data_list}}</view>
					</view>
				</view>
				<view class="flex-between">
					<view>开始时间：</view>
					<view>{{checkdata.start_time}}</view>
				</view>
				<view class="flex-between">
					<view>结束时间：</view>
					<view>{{checkdata.end_time}}</view>
				</view>
			</view>
			<view v-if="checkdata.fish_new_type == 1">
				<view class="flex-between">
					<view>开始时间：</view>
					<view>{{checkdata.venue_start_date}}</view>
				</view>
				<view class="flex-between">
					<view>结束时间：</view>
					<view>{{checkdata.venue_end_date}}</view>
				</view>
				<view class="flex-between" >
					<view>垂钓时长：</view>
					<view>{{checkdata.hours}}</view>
				</view>
			</view>
		</view>

		<view class="leftBorder">费用信息</view>
		<view class="box">
			<view class="flex-between">
				<view>原票价：</view>
				<view>{{checkdata.origin_price}} 元</view>
			</view>
			<view class="flex-between">
				<view>特惠价：</view>
				<view>{{checkdata.favour_price}} 元</view>
			</view>
			<view class="flex-between" v-for="item in checkdata.groupBuyList">
				<view>{{item.peopleNumber}}人团购价：</view>
				<view>{{item.price}} 元</view>
			</view>
			<view class="flex-between">
				<view>限制人数：</view>
				<view>{{checkdata.limit_applicant_num}}</view>
			</view>
		</view>
		<view class="leftBorder">退票退款设置<switch class="switch" :checked="checkdata.is_return_and_refund" color="#D43030"  style="transform:scale(0.7)" disabled /></view>
		<view class="box">
			<text style="white-space: pre-wrap;">
				1、开场24小时前退预付数的95%，开场10小时前退预付款的70%，开场放号前退票，退还预付收的50%，开场放号后不予以退票，特殊情况请联系钓场。
				2、占位卡退票规则：占位卡放号前可全额退款，占位卡放号后不支持退款。
			</text>
		</view>
		<view class="leftBorder">活动内容<switch class="switch" :checked="checkdata.is_activity" color="#D43030"  style="transform:scale(0.7)" disabled /></view>
		<view class="box" v-if="checkdata.is_activity">
			<text style="white-space: pre-wrap;">
				{{checkdata.activity_content}}
			</text>
		</view>
		<view class="leftBorder">鱼汛规则</view>
		<view class="box">
			<text style="white-space: pre-wrap;">
				{{checkdata.content}}
			</text>
		</view>
		<view class="flex-around">
			<button class="back" @click="back">返回修改</button>
			<button class="save" @click="submit">确认发布</button>
		</view>
	</view>
</template>

<script>
	import { add_fish_news, update_fish_news } from '@/utils/fishNew/index.js'
	export default {
		data() {
			return {
				checkdata:{}
			}
		},
		onLoad() {
			let that=this
			const eventChannel= this.getOpenerEventChannel()
			eventChannel.on('setObj', function(data){
			    console.log(data);
				that.checkdata = data.data
			})
		},
		methods: {
			back() {
				 uni.navigateBack({
					 delta:1
				 })
			},
			submit() {
				if(this.checkdata.id){
					update_fish_news(this.checkdata,this.checkdata.id).then(res=>{
						if(res.code==200){
							uni.redirectTo({
								url: '/pages/fishTickets/addSession/publishSuccess'
							})
						}
					})
				}else{
					add_fish_news(this.checkdata).then(res=>{
						if(res.code==200){
							uni.redirectTo({
								url: '/pages/fishTickets/addSession/publishSuccess'
							})
						}
					})
				}
			},
		}
	}
</script>

<style scoped lang="scss">
	.check {
		padding: 20rpx 40rpx;
		.leftBorder{
			border-left: 8rpx solid #D43030;
			height: 40rpx;
			line-height: 40rpx;
			font-weight: 700;
			padding-left: 20rpx;
			margin-bottom: 30rpx;
			margin-top: 20rpx;
			position: relative;
			.switch{
				position: absolute;
				right: 0;
				top: -16rpx;
			}
		}
		.box{
			font-size: 24rpx;
			line-height: 60rpx;
			color: #000000;
		}
		.chooseArea{
			font-size: 24rpx;
			.areaitem{
				margin: 30rpx 0;
				span{
					// display: inline-block;
					padding: 6rpx 20rpx;
					background: rgba(212, 48, 48, 0.3);
					border: #D43030 1rpx solid;
					margin-right: 20rpx;
					color: #D43030;
				}
			}
		}
		
		.data_list{
			flex-wrap: wrap;
			flex: 1;
			margin-left: 20rpx;
		}
		.data_list_item{
			background: #D43030;
			color: #fff;
			margin-left: 20rpx;
			padding: 0 20rpx;
			margin-bottom: 10rpx;
		}
		.save{
			height: 68rpx;
			color: #fff;
			line-height: 68rpx;
			width: 190rpx !important;
			border-radius: 30rpx;
			background: #D43030 !important;
			margin: 30rpx auto;
			font-size: 24rpx;
		}
		.back{
			height: 68rpx;
			line-height: 68rpx;
			width: 190rpx !important;
			background: #fff !important;
			color: #D43030 !important;
			border: #D43030 2rpx solid !important;
			font-size: 24rpx;
			border-radius: 30rpx;
			margin: 30rpx auto;
		}
	}
</style>
